﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TalentPool.master" Inherits="WebManager.BasePage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Import Namespace="TalentPools.BLL" %>
<%@ Import Namespace="TalentPools.Model" %>
<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
           
        }
    }
    protected void btnsubmit_Click(object sender, ImageClickEventArgs e)
    {
        if (IsValid)
        {
            string imgCode = txtUcode.Text.Trim().ToUpper();
            if (Session["imgCode"].ToString().ToUpper()!=imgCode)
            {
                JsWindows("验证码错误,请重新输入！", "PersonReg.aspx");
                return;
            }
            WebManager.BasePage basepage=new WebManager.BasePage();
            Person_Login Person = new Person_Login();
            Person.UserName = basepage.MyFormatstr(txtusername.Text.Trim());
            Person.UserPwd = basepage.MyFormatstr(FormsAuthentication.HashPasswordForStoringInConfigFile(txtpwd.Text.Trim(),"MD5"));
            Person.RegTime = DateTime.Now;
            Person.Question = basepage.MyFormatstr(txtQuestion.Text.Trim());
            Person.Answer = basepage.MyFormatstr(txtAnswer.Text.Trim());
            Person.IpAdd=Request.ServerVariables["REMOTE_ADDR"];
            Person.Email = txtEmail.Text.Trim();
            Person.state = false;
            if (new Person_LoginManager().CheckUsername(Person.UserName) <= 0)
            {
                if (new Person_LoginManager().RegPersonUser(Person))
                {
                    UserCookie(Person.UserName);
                    Response.Redirect("Index.aspx");
                }
            }
            else
            {
                JsWindows("用户名存在", "");
            }
            
        }
    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="css/alertresume.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table width="650px" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr style="margin:0px auto;">
            <td style="height:76px">
                <img src="img/reg_01_xz.gif" width="650" style="height: 76px" />
            </td>
        </tr>
        <tr style="margin:0px auto;">
            <td style="background-image: url(img/reg_02.jpg); width: 650px; margin: 0 auto;">
                <table class="tableMain" style=" width:90%;" cellpadding="0" cellspacing="0">
                    <tr>
                        <td class="titleStyle">
                            用户名：
                        </td>
                        <td class="textStyle" >
                            <asp:TextBox ID="txtusername" runat="server" Style="margin-left: 0px" ValidationGroup="first"
                                BorderStyle="None" MaxLength="20" Width="195px"></asp:TextBox>
                        </td>
                        <td class="valStyle" style="width: 97px">
                            &nbsp;
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtusername"
                                ErrorMessage="用户名不为空"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="titleStyle">
                            密码：
                        </td>
                        <td class="textStyle">
                            <asp:TextBox ID="txtpwd" runat="server" Style="margin-left: 0px" BorderStyle="None"
                                MaxLength="20" Width="195px" TextMode="Password"></asp:TextBox>
                        </td>
                        <td class="valStyle" style="width: 97px">
                            &nbsp;
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtpwd"
                                ErrorMessage="密码不能为空"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="titleStyle">
                            确认密码：
                        </td>
                        <td class="textStyle">
                            <asp:TextBox ID="txtrepwd" runat="server" Style="margin-left: 0px" BorderStyle="None"
                                MaxLength="20" Width="195px" TextMode="Password"></asp:TextBox>
                        </td>
                        <td class="valStyle" style="width: 97px">
                            &nbsp;
                            <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtpwd"
                                ControlToValidate="txtrepwd" ErrorMessage="两次密码不同"></asp:CompareValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="titleStyle">
                            邮箱：</td>
                        <td class="textStyle">
                            <asp:TextBox ID="txtEmail" runat="server" Style="margin-left: 0px" ValidationGroup="first"
                                BorderStyle="None" MaxLength="20" Width="195px"></asp:TextBox>
                        </td>
                        <td class="valStyle" style="width: 97px">
                            &nbsp;
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                ErrorMessage="邮箱不能为空" ControlToValidate="txtEmail"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ControlToValidate="txtEmail" EnableClientScript="False" ErrorMessage="邮箱格式错误！" 
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="titleStyle">
                           安全问题：
                        </td>
                        <td class="textStyle">
                            <asp:TextBox ID="txtQuestion" runat="server" ValidationGroup="first" BorderStyle="None"
                                Width="195px"></asp:TextBox>
                        </td>
                        <td class="valStyle">
                            &nbsp;
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                ControlToValidate="txtQuestion" ErrorMessage="请输入问题"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="titleStyle">
                            答案：
                        </td>
                        <td class="textStyle">
                            <asp:TextBox ID="txtAnswer" runat="server" ValidationGroup="first" BorderStyle="None"
                                Width="195px"></asp:TextBox>
                        </td>
                        <td class="valStyle">
                            &nbsp;
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                                ControlToValidate="txtAnswer" ErrorMessage="请输入答案"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="titleStyle">
                            验证码：
                        </td>
                        <td class="textStyle">
                            <asp:TextBox ID="txtUcode" runat="server"  BorderStyle="None"
                                Width="195px"></asp:TextBox>
                        </td>
                        <td class="valStyle">
                            &nbsp;
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                                ControlToValidate="txtUcode" ErrorMessage="请输入验证码"></asp:RequiredFieldValidator>
                            <img src="HandlerControl/RndNumber.aspx" style="border: 1px #666666 solid; cursor: hand;"
                                                    onclick="this.src=this.src+'?'" alt="看不清？换个图片" />
                            </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <asp:ImageButton ID="btnsubmit" runat="server" ImageUrl="~/img/resi.gif" OnClick="btnsubmit_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <img src="img/reg_03.jpg" width="650" height="36" />
            </td>
        </tr>
    </table>
</asp:Content>
